{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('list', array('op' => 'post'));}">编辑/添加WiFi</a></li>
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('list', array('op' => 'display'));}">WiFi列表</a></li>
</ul>
{if $op == 'display'}
<style>
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
th{
	text-align: center !important;
}
td{
	text-align: center !important;
}
</style>
<div class="main">
	<form action="" method="get" class="form-horizontal" role="form">
		<div class="panel panel-info">
	        <div class="panel-heading">筛选</div>
	        <div class="panel-body">
	                <input type="hidden" name="c" value="site" />
	                <input type="hidden" name="a" value="entry" />
	                <input type="hidden" name="m" value="junsion_wifinav" />
	                <input type="hidden" name="do" value="list" />
	                <div class="form-group">
	                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
	                    <div class="col-sm-3 col-xs-12">
	                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="请输入名称">
	                    </div>
	                    <div class=" col-xs-12 col-sm-6 col-lg-3">
	                        <button class="btn btn-default" ><i class="fa fa-search"></i> 搜索</button>
	                        <a href="{php echo $this->createWebUrl('list', array('op' => 'allQrcode'))}" title="二维码" class="btn btn-danger"><i class="fa fa-qrcode"></i> 下载所有二维码</a>
	                   	</div>
	                </div>
	                
	        </div>
	    </div>
	</form>
	<div style="padding:15px;background: white;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th>MAC</th>
					<th>名称</th>
					<th>状态</th>
					<th>广告图</th>
					<th>二维码/修改/删除</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>{$item['BSSID']}</td>
					<td>{$item['SSID']}</td>
					<td>{if $item['status']==1}<label class="label label-success">正常</label>{else if $item['status']==2}<label class="label label-default">失效</label>{/if}</td>
					<td>{if $item['advPic']}<a target="_blank" href='{$item['advPic']}'><img width="150px" src='{$item['advPic']}'></a>{/if}</td>
					<td>
						<a href="{php echo $this->createWebUrl('list', array('op' => 'qrcode', 'id' => $item['id']))}" title="二维码" class="btn btn-sm btn-default"><i class="fa fa-qrcode"></i></a>
						<a href="{php echo $this->createWebUrl('list', array('op' => 'post', 'id' => $item['id']))}" title="编辑" class="btn btn-sm btn-default"><i class="fa fa-edit"></i></a>
						<a onclick="return confirm('确认删除此WiFi吗？'); return false;" href="{php echo $this->createWebUrl('list', array('op' => 'del','id' => $item['id']))}" title="删除" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{else if $op == 'post'}
<div class="panel panel-info">
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
			<input type="hidden" name="id" value="{$item[id]}">
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">WiFi名</label>
				<div class="col-sm-4">
					<input class="form-control" name="SSID" type="text" value="{$item['SSID']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">MAC地址</label>
				<div class="col-sm-4">
					<input class="form-control" name="BSSID" type="text" value="{$item['BSSID']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">密码</label>
				<div class="col-sm-4">
					<input class="form-control" name="password" type="text" value="{$item['password']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
				<div class="col-sm-4">
					<label style="margin-left: 10px;"><input type="radio" name="status" {if $item['status']==1 || !$item}checked="checked"{/if} value="1"> 正常</label>
					<label style="margin-left: 10px;"><input type="radio" name="status" {if $item['status']==2}checked="checked"{/if} value="2"> 失效</label>
				</div>
			</div>
			<button type="submit" class="btn btn-primary" name="submit" value="提交">保存</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
			</form>
	</div>
</div>
{/if}
{template 'common/footer'}